﻿@model AwesomeSlider.Models.SliderPart
@using AwesomeSlider.Extensions
@using System.Web.Mvc

<h1>@Html.TitleForPage(string.Format("{0} {1}", T("Add items for"), Model.Name).ToString())</h1>

@{
    Style.Require("SliderAdmin");
    Style.Require("SliderFileUploadCSS");

    Script.Require("SliderFileuploadAdmin");    
}

<div class="manage">    
    <a href="@Url.SliderItem(Model)" 
        class="add button">
        @T("Back to slider")
    </a>
</div>

@using (Html.BeginFormAntiForgeryPost(Url.SliderItemUpload(Model), FormMethod.Post, new { @id = "file_upload", enctype = "multipart/form-data" }))
{
    @Html.ValidationSummary()

    <input type="file" name="file" multiple/>
    <div>@T("Select files")</div>    
}
@using (Html.BeginFormAntiForgeryPost(Url.SliderItemAdd(Model), FormMethod.Post, new { @id = "file_upload", enctype = "multipart/form-data" }))
{ 
    <table id="files" class="items"></table>
    <fieldset class="save-button" style="display: none">
        <button value="Save" name="action" type="submit" class="primaryAction">
            @T("Save")</button>
        <button value="Cancel" name="action" type="submit" >
            @T("Cancel")</button>
    </fieldset>
}

@using (Script.Foot())
{
    <script type="text/javascript">
        $(function () {
            var options = {

            };
            var strings = {
                cancel: '@T("Cancel")',
                uploading: '@T("Uploading")',
                name: '@T("Name")',
                error: '@T("Upload image failed.")',
                errorNotImage: '@T("Uploaded file is not image.")',
                errorEmpty: '@T("Uploaded file is empty.")',
                errorLarge: '@T("Uploaded file is too large. Max file size:")',
                mb: '@T("Mb")'
            };
            AdminUploadInitializer(options, strings);
        });
    </script>
}
